package crudfx.util;

import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javafx.scene.paint.*;

/**
 * @profile desktop
 * @author Sergey Surikov
 */
 
public class ImagePaint extends Paint{
    public var bufferedImage:BufferedImage=null;
    public override function impl_getPlatformPaint():Object{
        /*
        var g = bi.createGraphics ();
        g.drawImage (image.getImage (), 0, 0, null);
        g.dispose ();
        */
        if(bufferedImage==null)bufferedImage=new BufferedImage(16,16,BufferedImage.TYPE_INT_RGB);
        var anchor=new Rectangle2D.Double(0,0
            ,bufferedImage.getWidth(),bufferedImage.getHeight());
        var p:java.awt.TexturePaint=new java.awt.TexturePaint
            (bufferedImage, anchor);
        return p;
        }
    }
